<template>
  <div class="scanner-container">
    <fm-nav-bar
      title="二维码扫描"
      :border="false"
      left-arrow
      @click-left="back"
    />
    <div class="scanner-name">扫描结果</div>
    <div class="scanner-value">{{ scanner }}</div>
    <!-- <div class="scanner-btn">
      <fm-button round type="primary" @click="open" size="small"
        >浏览器访问</fm-button
      >
    </div> -->
  </div>
</template>
<script>
export default {
  name: 'scanner',
  data() {
    return {
      scanner:
        '暂无数据',
    }
  },
  methods: {
    handleScanner() {
      if (typeof yuanchu != 'undefined') {
        yuanchu?.scanner?.openScanner((res) => {
          if (res) {
            this.scanner = res
          }
        })
      }
    },
    back() {
      this.$router.go(-1)
    },
  },
  mounted() {
    this.handleScanner()
  },
}
</script>
<style lang="less" scoped>
.scanner-container {
  height: 100%;
  background: #f2f3f5;
  text-align: center;
  .scanner-name {
    margin-top: 80px;
    font-size: 28px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 600;
    color: #414b59;
    line-height: 40px;
  }
  .scanner-value {
    margin: 30px 16px;
    font-size: 28px;
    font-family: PingFangSC-Regular, PingFang SC;
    color: #727478;
    font-weight: 400;
    line-height: 44px;
    word-break: break-all;
    word-wrap: break-word;
  }
}
</style>